<?php
	$this->document->addStyle('themes/' . C('config_template') . '/stylesheet/product-carousel.css');
	$span = C('pav_product_span');
	$cols = 12 / $span;
?>
<div class="box productcarousel">
	<div class="box-heading"><h3><span><?php echo $heading_title; ?></span></h3></div>
	<div class="box-content" >
 		<div class="box-products slide" id="productcarousel<?php echo $module;?>">
			<?php if( count($products) > $cols ) { ?>
			<div class="carousel-controls">
			<a class="carousel-control left" href="#productcarousel<?php echo $module;?>"   data-slide="prev">&lsaquo;</a>
			<a class="carousel-control right" href="#productcarousel<?php echo $module;?>"  data-slide="next">&rsaquo;</a>
			</div>
			<?php } ?>
			<div class="carousel-inner ">		
			 <?php 
				$pages = array_chunk( $products, $cols);
			 ?>	
			  <?php foreach ($pages as  $k => $tproducts ) {   ?>
					<div class="item <?php if($k==0) {?>active<?php } ?>">
					<div class="row-fluid box-product">
						<?php foreach( $tproducts as $i => $product ) { ?>							
						  <div class="span<?php echo $span;?> product-block"><div class="product-inner">
						  	
							<?php if ($product['thumb']) { ?>
							<div class="image">
								<?php if( $product['special'] ) {   ?>
						    	<div class="product-label-special label"><?php echo $_['text_sale']; ?></div>
						    	<?php } ?>
						    	<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a>
						      </div>
							<?php } ?>
							<div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
							<div class="description"><?php echo $product['summary'] ?></div>
							 <div class="group-item"> 
							<div class="rating"><img src="themes/<?php echo C('config_template');?>/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
							
							
						    <div class="price-cart">
							  <?php if ($product['price']) { ?>
							 <div class="price">
								  <?php if (!$product['special']) { ?>
								  <?php echo $product['price']; ?>
								  <?php } else { ?>
								  <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
								  <?php } ?>
								</div>
							  <?php } ?>
							  
							  <div class="cart">
								<input type="button" value="<?php echo $_['button_cart']; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
							  </div>
							  </div>
							  </div>
							  <div class="wishlist-compare">
								  <a class="wishlist" onclick="addToWishList('<?php echo $product['product_id']; ?>');" title="<?php echo $_['button_wishlist']; ?>" ><?php echo $_['button_wishlist']; ?></a>
								  <a class="compare"  onclick="addToCompare('<?php echo $product['product_id']; ?>');" title="<?php echo $_['button_compare']; ?>" ><?php echo $_['button_compare']; ?></a>
							 </div>
						  
						  </div>
						  </div>
						<?php } //endforeach; ?>
					</div>
				</div>	
			  <?php } ?>
		</div>
 </div> </div>
</div>
<script type="text/javascript">
$('#productcarousel<?php echo $module;?>').carousel({interval:3000,auto:true,pause:'hover'});
</script>